/*
 * @Author: Bennty
 * @Date: 2024-07-16 13:07:53
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2024-09-13 16:05:18
 * @Description: 请填写简介
 */
import request from '@/utils/request';

/** 新增合同 */
export const addContractApi = (data: any)=>{
    return request({
        url: '/system/contractInfo',
        method: 'post',
        data: data
    })
};

/** 查询合同基础信息列表 */
export const getContractApi = (data: any)=>{
    return request({
        url: '/system/contractInfo/list',
        method: 'post',
        data: data
    })
};

/** 修改合同信息 */
export const editContractApi = (data: any)=>{
    return request({
        url: '/system/contractInfo',
        method: 'put',
        data: data
    })
};

/** 删除合同基础信息 */
export const deleteContractApi = (ids: any)=>{
    return request({
        url: `/system/contractInfo/${ids}`,
        method: 'delete',
    })
};

/** 获取合同基础信息详细信息 */
export const getContractDetailsApi = (id: any)=>{
    return request({
        url: `/system/contractInfo/${id}`,
        method: 'get',
    })
};

/** 合同完结 */
export const completeContractDetailsApi = (data: any)=>{
    return request({
        url: `/system/contractInfo/updateContractStatus`,
        method: 'put',
        params: data
    })
};

/**新增合同审批记录 */
export const approveContractDetailsApi = (data: any)=>{
    return request({
        url: `/system/contractApprovalRecord`,
        method: 'post',
        data: data
    })
};

/** 修改审批状态 */
export const updateApproveApi = (data: any) => {
    return request({
        url: '/system/contractApprovalRecord',
        method: 'put',
        data: data
    });
};

/** 新增销售审核记录 */
export const examineContractDetailsApi = (data: any)=>{
    return request({
        url: `/system/saleApprovalRecord`,
        method: 'post',
        data: data
    })
};

/** 根据合同id查询销售审核记录 */
export const getExaminesRecordByIdApi = (id: any)=>{
    return request({
        url: `/system/saleApprovalRecord/queryByContractId`,
        method: 'get',
        params: {contractId: id}
    })
};

/** 财务审核 */
export const addFinanceExamineApi = (data: any) => {
    return request({
        url: '/system/saleApprovalRecord/financeApprove',
        method: 'put',
        data: data
    });
};

/** 撤销审核 */
export const revokeExamineApi = (id: any) => {
    return request({
        url: '/system/saleApprovalRecord/revoke',
        method: 'delete',
        params: {contractId: id}
    });
};

/** 定金退还申请 */
export const refundDepositsApi = (data: any)=>{
    return request({
        url: `/system/contractReturnRecord`,
        method: 'post',
        data: data
    })
};